local weimou = fk.CreateSkill{
  name = "lingling__weimou",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["lingling__weimou"] = "危谋",
  [":lingling__weimou"] = "锁定技，当你受到【杀】造成的伤害后，你随机获得一张锦囊牌。当你受到锦囊牌造成的伤害后，你获得一张【杀】。",
}

weimou:addEffect(fk.Damaged, {
  anim_type = "masochism",
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(weimou.name) and
      data.card and (data.card.trueName == "slash" or data.card.type == Card.TypeTrick)
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local cards = room:getCardsFromPileByRule(data.card.type == Card.TypeTrick and "slash" or ".|.|.|.|.|trick", 1, "allPiles")
    if #cards > 0 then
      room:moveCardTo(cards, Card.PlayerHand, player, fk.ReasonJustMove, weimou.name, nil, true, player)
    end
  end,
})

return weimou
